package com.wn.date20190820Socket;

import java.util.Scanner;

/**
 * 聊天客户端，主函数
 * @author song
 *
 */
public class ChatClient
{

	public static void main(String[] args) throws Exception
	{
		Scanner scanner=new Scanner(System.in);
		// 启动服务器
		System.out.println("请输入本地端口，如12345");
		int localport=scanner.nextInt();
		new Thread(new ChatServer(localport)).start();
		// 启动消息发送
		System.out.println("请输入远程主机，如song的ip：192.168.2.171");
		String name=scanner.next();
		System.out.println("远程端口，如12345");
		int port=scanner.nextInt();
		SentMsg send=new SentMsg(name,port);
		// chat
		while(true)
		{
			System.out.println("请输入消息：");
			send.send(scanner.next());
		}
	}

}
